package com.plateform.shardingsphere.config;

/**
 * @ClassName ShardingTablesLoadRunner
 * @Description: TODO
 * @Author liupantao
 * @Date 2022/10/20
 * @Version V1.0
 **/


import groovy.util.logging.Slf4j;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * 项目启动后 读取已有分表 进行缓存
 */
@Slf4j
@Component
public class ShardingTablesLoadRunner implements CommandLineRunner {

    Logger logger = LoggerFactory.getLogger (ShardingTablesLoadRunner.class);
    @Override
    public void run(String... args) {

        ShardingAlgorithmTool.tableNameCacheReload();
        logger.info ("Sharding-jdbc 加载完毕");
    }
}


